﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace blackhouse.StareKino.Web.Contact {
    internal class ContactPlaces:IEnumerable<ContactPlace> {

        #region Fields

        private IEnumerable<ContactPlace> places;

        #endregion

        #region Constructors

        internal ContactPlaces(IEnumerable<ContactPlace> contactPlaces) {
            this.places = contactPlaces;
        }

        #endregion

        #region Methods

        public IEnumerator<ContactPlace> GetEnumerator() {
            return this.places.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
            return this.places.GetEnumerator();
        }

        internal IEnumerable<ContactPlaceCategory> GetCategories() {
            return this.places.Select(cp => cp.Category).OrderBy(c => c.CategoryName).Distinct();
        }

        #endregion

    }
}